1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module sourceview.Map;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gtk.Widget;
30 private import sourceview.View;
31 private import sourceview.c.functions;
32 public  import sourceview.c.types;
33 
34 
35 /**
36  * Widget that displays a map for a specific [class@View].
37  * 
38  * `GtkSourceMap` is a widget that maps the content of a [class@View] into
39  * a smaller view so the user can have a quick overview of the whole document.
40  * 
41  * This works by connecting a [class@View] to to the `GtkSourceMap` using
42  * the [property@Map:view] property or [method@Map.set_view].
43  * 
44  * `GtkSourceMap` is a [class@View] object. This means that you can add a
45  * [class@GutterRenderer] to a gutter in the same way you would for a
46  * [class@View]. One example might be a [class@GutterRenderer] that shows
47  * which lines have changed in the document.
48  * 
49  * Additionally, it is desirable to match the font of the `GtkSourceMap` and
50  * the [class@View] used for editing. Therefore, [property@Map:font-desc]
51  * should be used to set the target font. You will need to adjust this to the
52  * desired font size for the map. A 1pt font generally seems to be an
53  * appropriate font size. "Monospace 1" is the default. See
54  * [method@Pango.FontDescription.set_size] for how to alter the size of an existing
55  * [struct@Pango.FontDescription].
56  * 
57  * When FontConfig is available, `GtkSourceMap` will try to use a bundled
58  * "block" font to make the map more legible.
59  */
60 public class Map : View
61 {
62 	/** the main Gtk struct */
63 	protected GtkSourceMap* gtkSourceMap;
64 
65 	/** Get the main Gtk struct */
66 	public GtkSourceMap* getMapStruct(bool transferOwnership = false)
67 	{
68 		if (transferOwnership)
69 			ownedRef = false;
70 		return gtkSourceMap;
71 	}
72 
73 	/** the main Gtk struct as a void* */
74 	protected override void* getStruct()
75 	{
76 		return cast(void*)gtkSourceMap;
77 	}
78 
79 	/**
80 	 * Sets our main struct and passes it to the parent class.
81 	 */
82 	public this (GtkSourceMap* gtkSourceMap, bool ownedRef = false)
83 	{
84 		this.gtkSourceMap = gtkSourceMap;
85 		super(cast(GtkSourceView*)gtkSourceMap, ownedRef);
86 	}
87 
88 
89 	/** */
90 	public static GType getType()
91 	{
92 		return gtk_source_map_get_type();
93 	}
94 
95 	/**
96 	 * Creates a new `GtkSourceMap`.
97 	 *
98 	 * Returns: a new #GtkSourceMap.
99 	 *
100 	 * Throws: ConstructionException GTK+ fails to create the object.
101 	 */
102 	public this()
103 	{
104 		auto __p = gtk_source_map_new();
105 
106 		if(__p is null)
107 		{
108 			throw new ConstructionException("null returned by new");
109 		}
110 
111 		this(cast(GtkSourceMap*) __p);
112 	}
113 
114 	/**
115 	 * Gets the [property@Map:view] property, which is the view this widget is mapping.
116 	 *
117 	 * Returns: a #GtkSourceView or %NULL.
118 	 */
119 	public View getView()
120 	{
121 		auto __p = gtk_source_map_get_view(gtkSourceMap);
122 
123 		if(__p is null)
124 		{
125 			return null;
126 		}
127 
128 		return ObjectG.getDObject!(View)(cast(GtkSourceView*) __p);
129 	}
130 
131 	/**
132 	 * Sets the view that @map will be doing the mapping to.
133 	 *
134 	 * Params:
135 	 *     view = a #GtkSourceView
136 	 */
137 	public void setView(View view)
138 	{
139 		gtk_source_map_set_view(gtkSourceMap, (view is null) ? null : view.getViewStruct());
140 	}
141 }